<template>
	<view>
		<cu-custom bgColor="bg-gradual-green" :isBack="true">
			<view slot="backText">返回</view>
			<view slot="content">查看地图</view>
		</cu-custom>
		<map style="width: 100vw; height: 100vh;" :latitude="latitude" :longitude="longitude" :markers="covers"></map>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				latitude: 0,
				longitude: 0,
				covers: [{
					id: 0,
					title: '目标地点',
					width: 30,
					height: 30,
					latitude: 0,
					longitude: 0,
					iconPath: '../../static/location-fill.png'
				}]
			}
		},
		methods: {},
		onLoad(option) {
			this.latitude = this.covers[0].latitude = option.latitude
			this.longitude = this.covers[0].longitude = option.longitude
			uni.getLocation({
				type: 'gcj02',
				isHighAccuracy: true,
				success: (res) => {
					this.covers.push({
						id: 1,
						title: '当前地点',
						width: 30,
						height: 30,
						latitude: res.latitude,
						longitude: res.longitude,
						iconPath: '../../static/location.png'
					})
					// console.log('当前位置纬度' + res.latitude)
					// console.log('当前位置经度' + res.longitude)
					// console.log(res.accuracy)
				},
				fail: (err) => {
					console.log('错误', err);
				}
			})
		}
	}
</script>

<style>

</style>
